package Utils;

import com.smart.domain.Express;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

/**
 * @ClassName dateUtil
 * @Description 工具类
 * @Author wangqian
 * @Date 2019/4/15 22:56
 **/

public class dateUtil {
    public  String date(){//获得系统当前时间
        Calendar now = Calendar.getInstance();
        int year=now.get(Calendar.YEAR);
        int month=now.get(Calendar.MONTH) + 1;
        int day=now.get(Calendar.DAY_OF_MONTH);
        int hour=now.get(Calendar.HOUR_OF_DAY);
        int min=now.get(Calendar.MINUTE);
        String date="";
        if(min<10){
             date+=year+"-"+month+"-"+day+" "+hour+":0"+min;
        }else{
             date+=year+"-"+month+"-"+day+" "+hour+":"+min;
        }
        return date;
    }
    public List changeStatus(List list) {//转换揽件状态，0->等待揽件，1->已揽件
        Iterator iterator = list.iterator();
        while(iterator.hasNext()){
            Express express=(Express)iterator.next();
            System.out.println(express.getE_status()+"*************");
            if(express.getE_status().equals("0")){
                express.setE_status("等待揽件");
            }
            else
                express.setE_status("已揽件");
        }
        return list;
    }
}
